<!DOCTYPE HTML>
<html>
<head>
    <meta charset="UTF-8">
    <title>签到总览</title>
    <link rel="stylesheet" type="text/css" href="layui/css/layui.css">
    <style type="text/css">
        .layui-table-cell {
            height: 100%;
            max-width: 100%;
        }
    </style>
</head>
<body>

<form class="layui-form">
    <div class="layui-inline">
        <div class="layui-input-inline">
            <input type="text" id="value" style="width: 330px" name="value" lay-verify="required" placeholder="请输入用户昵称" autocomplete="off" class="layui-input">
        </div>
    </div>
    <button type="button" class="layui-btn" id="search">搜索</button>
</form>

<table id="signTable" lay-filter="signTable"></table>



<script type="text/javascript" src="layui/layui.js"></script>
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">


    layui.use(['table','layer'],function () {

        var table = layui.table;
        var layer = layui.layer;
        table.render({
            elem:'#signTable'
            ,url:'sign/list'
            ,page:true
            ,limit:6
            ,limits:[6,8,10,15]
            ,cols:[[
                {field:'id',title:'编号',sort:true, align:'center'}
                ,{field:'openid',title:'用户标识', align:'center'}
                ,{field:'username',title:'用户昵称', align:'center'}
                ,{field:'sign',title:'签到次数', align:'center'}
            ]]
        });


        /**
         * 搜索功能
         * */
        $("#search").click(function () {
            if($("#value").val()==""){
                table.reload("signTable",{
                    url:'sign/list',
                    page:{
                        curr:1
                    }
                });
            }else{
                table.reload("signTable",{
                    url:'sign/search',
                    where:{
                        username:$("#value").val()
                    }
                });
            }
        });







    });
</script>



</body>
</html>